package com.example.springboot_1;

import com.example.springboot_1.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-10-13
 * Time:10:39
 */
@RequestMapping("/user")
@Controller
public class UserController {

    @Value("${server.port}")
    private String port;

    @Autowired
    private Student student;
    @Autowired
    private Student student2;

    @ResponseBody//返回一个非静态页面的数据，会将数据进行打印
    @RequestMapping("/test")//配置路由
    public String sayHi(){
        student.setAge(100);
        return student.toString()+"   "+this.port+student2.toString();
    }
}
